<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>个人中心</title>
</head>
<body>
    <div>
        <p id="userInfo"></p>
    </div>
</body>
<script>
    var user=null;
    window.onload = function (ev) {
        var userInfo = document.getElementById("userInfo");
        xhr = new XMLHttpRequest();
        xhr.open("POST","../GetUserInfo",true);
        xhr.send();
        xhr.onreadystatechange = function (ev1) {
            if(xhr.readyState==4&&xhr.status==200)
            {
                var str = null;
               var content = xhr.responseText;
               if(content=="no")
               {
                   str = "登录信息过期";
               }
               else {
                   user = JSON.parse(content);
                   str = "姓名： " + user.name + "    性别： " + user.sex + "   年龄： " + user.age;
               }
               userInfo.innerText = str;

            }
        }
    }
</script>
</html>